LIST

Section: SOS CLASS LIBRARY (3S)
Updated: 28/10/1991
Index Return to Main Contents
man2html: unable to open or read file /usr/lib/ms/ms.acc
 

NAME

List<Entity> - predefined class List  

SYNOPSIS

#include "<SOS>/include/agg_sos.h"

class List<Entity> (sos_Bool based_on_equal = FALSE)
   : Collection<Entity> (based_on_equal)
{
public:
   void          append (Entity);
   void          insert (Index, Entity);
   void          remove (Index);
   Entity        get_nth (Index)
   void          set_nth (Index, Entity);

   // ** List operators **
   void          operator+= (List<Entity>);

   // ** sos_Cursor operations **
   Index        current_pos (sos_Cursor);
   sos_Bool     move_cursor (sos_Cursor, Index);
   void         insert_before (sos_Cursor, Entity);
   void         insert_after  (sos_Cursor, Entity);
   void         set (sos_Cursor, Entity);
}
 

DESCRIPTION

The class List<Entity> provides means for manipulating generic lists. The type of the elements of a List is stated when the List type is instantiated (Methods that overwrite inherited methods are only described in the superclass, where they are inherited from - provided that they are semantically equivalent).

List::create (ct, based_on_equal)
The create parameter based_on_equal determines if tests for membership in the List should be based on the equality or identity of the respective entities, as in superclass Collection.
append (e)
appends the element to the end of the List.
insert (i, e)
inserts entity e into the List at position i. The entity will be appended to the end of the List if (i > self.card () OR i == 0).

PRECONDITION: i >= 0

remove (i)
removes the element at position i from the List.

PRECONDITION: 1 <= i <= self.card ()

get_nth (i)
returns the element at the specified position of the List.

PRECONDITION: 1 <= i <= self.card ()

set_nth (i, e)
replaces the element at the given position i by the given element e.

PRECONDITION: 1 <= i <= self.card ()

operator+= (l)
appends all elements of the List l to the end of this List.

The following methods require an open sos_Cursor(3) as input parameter:

move_cursor (c, i)
repositions the cursor c to another index i in the List and returns TRUE, if that index is a valid index in the List, FALSE otherwise. If the index is not valid, the sos_Cursor remains unchanged.

PRECONDITION: c.defined_for (self) AND (1 <= i <= self.card ())

current_pos (c)
returns the index of the element to which the sos_Cursor c is currently referring to.

PRECONDITION: self.is_valid (c)

insert_before (c, e)
adds the given element e to the List before the element at the current position of sos_Cursor c.

PRECONDITION: self.is_valid (c)

insert_after (c, e)
adds the given element e to the List after the element at the current position of sos_Cursor c.

PRECONDITION: self.is_valid (c)

set (c, e)
replaces the element at the current position of sos_Cursor c by the given element e.

PRECONDITION: self.is_valid (c)

 

FILES

<SOS>/src/agg/agg.sos
SOS schema file

<SOS>/src/agg/agg_sos.h
complete schema interface

<SOS>/src/agg/agg_use.h
restricted schema interface

<SOS>/src/agg/agg_ext.h
definition of iterators (automatically included by agg_use.h)

<SOS>/src/agg/List.c
List implementation file

<SOS>/lib/sos.a
SOS library
 

SEE_ALSO

sos_Object(3), sos_Aggregate(3), Collection(3), sos_Cursor(3)  

AUTHOR

Bernhard Schiefer, Dietmar Theobald


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILES
SEE_ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 00:37:57 GMT, March 30, 2022